import getLabelEdit from '../../../../../../../edit/vue/labelEdit.js'
import ruleEdit from '../../../../../../../edit/vue/rule.js'
export default function getRuntimeConfig(config) {
    const LabelMixin = getLabelEdit(config)
    const ruleMixin = ruleEdit(config)
    const {setPannelValue,parseValue,getDataValue,getPropOfKey, getClassName} = config;
    const getZoom = () => {
        return window.$$Freelayout.utils.getFreeLayout()._infiniteViewer._zoom
    }
    return ({
        mixins: [LabelMixin,ruleMixin],
        mounted(){
        },
        methods: {
            openChange(open) {
                if(!open) {
                    return
                }
                this.scaleDom()
            },
            async scaleDom() {
                const iframeDocument = await document.querySelector('#iframe').contentDocument
                const popupKeyId = getClassName('popupKeyId')
                let dom = iframeDocument.querySelector(`.${popupKeyId}`)
                if(!dom) {
                    return
                }
                dom.style['transform-origin'] = '0 0'  
                dom.style['scale'] = getZoom() 
            }
        },
        __getEditorAttrs__(tagName,attribute) {
            if(['yt-custom-date-piker', 'yt-custom-range-picker', 'yt-custom-time-picker'].includes(tagName)) {
                return {
                    "@openChange": 'openChange'
                }
            }
        }
    })
}
